import * as ActionFunction from "../Action/ActionFunction";

const initialState = {
    id: '',
    name: '',
    token: '',
    mobile: '',
    business_licence:'',
    certificate:'',
    corporate_bankno:'',

    isLoggedIn: false,
    isLoggedOut: true,

    D_CarList: [],
    D_CarList_IsRefreshing: false,
    D_CarList_InNext: 0,
    D_CarList_Page: 1,
    D_CarList_Total: 1,

    D_HomeInfo: null,

    D_QueryAnalysis: [],
    D_QueryAnalysis_IsRefreshing: false,
    D_QueryAnalysis_InNext: 0,
    D_QueryAnalysis_Page: 1,
    D_QueryAnalysis_Total: 1,

    D_QueryBusiness: null,
    D_QueryBusiness_IsRefreshing: false,

    D_AboutUs: '',
    D_Login: null,


    D_MsgList: [],
    D_MsgList_IsRefreshing: false,
    D_MsgList_InNext: 0,
    D_MsgList_Page: 1,
    D_MsgList_Total: 1,

};

let UserReducer = (state = initialState, action) => {
    if (action.type === 'Complete') {
        return {
            ...state,
            ...action
        };
    } else if (action.type) {
        try {
            return eval(action.type + '(state, action)');
        }
        catch (exception) {
            return state;
        }
    }
    else {
        return state;
    }
};

export default UserReducer;